fix(lark): link feedback cards to persisted messages#447
Conversation
LikiosSedo
left a comment
There was a problem hiding this comment.
One P2 behavior regression found in the Runtime side; the exact-message linkage and the paired Sicore handling otherwise look sound.
| const isAnswer = !agentError && resultText.trim().length > 0; | ||
| const ok = await finalizeCard(larkClient, cardSession, finalCardBody, | ||
| isAnswer ? { ctx: { sessionId, channelId }, locale } : undefined); | ||
| isAnswer && assistantMessageId |
There was a problem hiding this comment.
[P2] Preserve feedback for delta-only replies
collectChannelResponse explicitly supports successful streams that end without an assistant message_end by falling back to parts.join("") (and lark.test.ts already covers that shape). In that path resultText is non-empty but assistantMessageId stays null, so this new guard removes the feedback row even though the previous code added one. That makes feedback disappear for a supported channel response shape. Please either persist the synthesized final text to obtain its exact message ID, or intentionally fall back to a legacy card without message_id, and add an end-to-end assertion for the delta-only card flow.
LikiosSedo
left a comment
There was a problem hiding this comment.
Re-reviewed at 7975b2c. The delta-only response path now persists the synthesized assistant reply, links the feedback card to the exact message ID, and has focused collector plus end-to-end Lark coverage. CI is green; no blocking issues remain.
Summary
chat.recordFeedbackmessage_idcompatibleRoot cause
Feishu feedback cards previously carried only the session and CardKit card ID. That was sufficient to identify the card, but not to unambiguously correlate an older card with its persisted assistant turn.
message_refremains the card aggregation and re-vote idempotency key. The newmessage_idis used only for the exact chat-message link.The field is optional on callbacks and RPC requests so cards created by older Runtime versions remain compatible.
Validation
npx vitest run src/gateway/channels/lark-card.test.ts src/gateway/channels/lark.test.ts— 144 tests passednpm run build— passedBoth checks ran on the development host with Node.js 22.22.3.